package com.pro.control;

import com.pro.dao.DictDataMapper;
import com.pro.entity.DictData;
import com.pro.entity.DictDataPlus;
import com.pro.entity.JsLogPlus;
import com.pro.entity.JsonData;
import com.pro.service.DictDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.logging.Logger;

/**
 * @ClassName: DictDataController
 * @Author: 笑笑
 * @DATE: 2021/11/7
 * @TIME: 下午 08:56
 */
@RestController
@RequestMapping("DictData")
public class DictDataController {

    @Autowired
    private DictDataService dictDataService;

    //查看商品操作日志
    @RequestMapping("getAllDictData")
    public JsonData getAllDictData(JsLogPlus dictData) {
        List<DictDataPlus> allDictData = dictDataService.getAllDictData(dictData);
        return allDictData != null ? JsonData.buildSuccess(allDictData) : JsonData.buildError("服务器错误");
    }

    //根据id删除商品操作日志
    @RequestMapping("deleteDictData")
    public JsonData deleteDictData(Integer id) throws Exception {
        boolean b = false;
        b = dictDataService.deleteDictData(id);
        return b ? JsonData.buildSuccess(b) : JsonData.buildError("服务器错误");
    }
}
